<script>
	
	export default {
		data() {
			return {

			}
		},
		watch: {

		},
		computed: {
			configs() {
				return this.$store.state.app.configs;
			},
			downloadRule() {
				return this.$store.state.app.downloadRule;
			},
		},
		methods: {
			
		},
		onLaunch: function(e) {
			console.log("onLaunch", e)
			let channel = "";
			// #ifdef APP-PLUS
			channel = plus.runtime.channel || null;
			// #endif
			
			// #ifdef H5
			channel = e.query.channel || null;
			// #endif
			
			// 记录本次channel, 没有时尝试从缓存中获取
			if (channel) {
				uni.setStorageSync("app.channel", channel);
			} else {
				channel = uni.getStorageSync("app.channel");
			}
			
			console.log("channel", !channel, channel)
			
			// #ifdef H5
			// if (window.navigator.userAgent.indexOf('Safari') != -1) {
			// 	window.history.pushState({}, 0, 'http://' + window.location.host + '/hezi/index.html?channel=' + channel + '#/')
			// }
			// #endif

			this.$store.commit("app/SET_CHANNEL", channel);
			
			this.$store.dispatch("app/GetConfigs").then(res => {
				console.log("getConfigs", res);
			});
			this.$store.dispatch("app/GetDownloadRule").then(res => {
				console.log("GetDownloadRule", res);
			});
		},
		onHide: function() {
			
		}
	}
</script>

<style lang="scss">
	/* 注意要写在第一行，同时给style标签加入lang="scss"属性 */
	@import "uview-ui/index.scss";
</style>
